﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace pxt
{
    abstract public class BaseCharacter
    {
        // Hitpoints
        protected float mCurHp, mMaxHp;
        protected int mDamage;
        protected Vector2 mPosition;
        protected Vector2 mVelocity;
        protected Rectangle mBoundingRect;
        protected float mSpeed;
        protected Texture2D mTexture, mUnitFrameImage;
        protected Texture2D mDeadTexture;
        protected string mName;
        protected bool mHasSpecial;
        // Spell info
        protected Texture2D mSpamSpellTex;
        protected Texture2D mDeathSpellTex;
        protected Texture2D mCooldownTex;
        abstract public void Update(GameTime gt);
        protected bool mIsAlive;
        protected Player mOwner;
        protected CScreenImageUnitFrame mUnitFrame;
        protected bool mHasReflectUp;

        public void TakeDamage(int amt)
        {
            mCurHp -= amt;

            if (mCurHp < 0)
            {
                mCurHp = 0;
                mIsAlive = false;
            }
            else if (mCurHp > mMaxHp)
            {
                mCurHp = mMaxHp;
            }
        }

        // Properties
        public Rectangle Bounds
        {
            get { return mBoundingRect; }
            set { mBoundingRect = value; }
        }
        public Vector2 Position
        {
            get { return mPosition; }
            set
            {
                if (null != value)
                {
                    mPosition = value;
                }
            }
        }
        public bool Alive
        {
            get { return mIsAlive; }
            set 
            {
                mCurHp = mMaxHp;
                mIsAlive = value; 
            }
        }

        public float Speed
        {
            get { return mSpeed; }
            set { mSpeed = value; }
        }

        public bool Special
        {
            get { return mHasSpecial; }
            set { mHasSpecial = value; }
        }
    }
}
